home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gb.d64
/
e puzzle.d
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
6KB
|
171 lines
1 REM - THE 'E' PUZZLE FOR COMMODORE 64
2 REM- DANIEL MILLER
3 REM- 2815 34 STREET
4 REM- ASTORIA, QUEENS
5 REM- NEW YORK, NEW YORK 11103
6 REM- APRIL 4, 1983
7 REM********************************
20 DIM B(12),C(12),A$(9),ER$(3)
30 GOSUB10000:GOTO1005
35 REM- SOUND ROUTINE
40 POKEVO,15:POKEWV,17:POKEAT,15:POKEHI,68:POKELO,149
50 FOR TM=1 TO 100:NEXT TM:POKEWV,0
55 POKEVO,15:POKEWV,17:POKEAT,15:POKEHI,34:POKELO,75
60 FOR TM=1 TO 100:NEXT TM:POKEWV,0:RETURN
300 REM- PUZZLE SCREEN
302 PRINTCHR$(19);TAB(22-(LEN(HDG$)/2));HDG$
303 X=49:FOR Y=1159 TO 1168 STEP3:POKEY,X:POKE Y+54272,14:X=X+1:NEXT Y
305 PRINT LEFT$(DO$,5);
310 PRINTTAB(14)A$(B(1));UP$;A$(B(2));UP$;A$(B(3));UP$;A$(B(4))
317 IF VAL(F2$)<>1 THEN320
318 GOSUB40
320 PRINTTAB(17)A$(B(5))
327 IF VAL(F2$)<>2 THEN330
328 GOSUB40
330 PRINTTAB(17)A$(B(6));UP$;A$(B(7))
337 IF VAL(F2$)<>3 THEN340
338 GOSUB40
340 PRINTTAB(17)A$(B(8))
347 IF VAL(F2$)<>4 THEN350
348 GOSUB40
350 PRINTTAB(14)A$(B(9));UP$;A$(B(10));UP$;A$(B(11));UP$;A$(B(12))
352 IF VAL(F2$)<>5 THEN355
353 GOSUB40
355 X=49:FOR Y=1235 TO 1715 STEP120:POKEY,X:POKE Y+54272,14:X=X+1:NEXT Y
360 PRINTLEFT$(DO$,21);TAB(18);MV$;
365 PRINTLEFT$(DO$,23);TAB(12);F3$;TAB(27);T3$;
366 IF ZZ=1 THEN FOR TM=1 TO 2000:NEXT TM:RETURN
370 REM- PUZZLE SOLVED ?
375 IF D$=D1$ THEN600
400 PRINTLEFT$(DO$,23);TAB(20);" ";TAB(31);" ";
405 PRINTLEFT$(DO$,23);TAB(20);" ";LEFT$(DO$,23);TAB(20);CR$;
410 GET F$:IF F$="" THEN410
412 GET G$:IF G$="" THEN412
415 FR$=F$+G$:PRINT FR$;:F$="":G$=""
417 IF FR$="99" THEN8310
419 IF LEFT$(FR$,1)<"1" OR LEFT$(FR$,1)>"5" THEN FR$="":GOTO405
421 IF RIGHT$(FR$,1)<"1" OR RIGHT$(FR$,1)>"4" THEN FR$="":GOTO405
423 H=VAL(FR$):GOSUB8000:FR=H:C(FR)=VAL(MID$(D$,FR,1))
430 PRINTLEFT$(DO$,23);TAB(31);" ";LEFT$(DO$,23);TAB(32);CR$;
432 GET F$:IF F$="" THEN432
434 GET G$:IF G$="" THEN434
436 TU$=F$+G$:PRINTTU$;:F$="":G$=""
438 IF LEFT$(TU$,1)<"1" OR LEFT$(TU$,1)>"5" THEN TU$="":GOTO430
440 IF RIGHT$(TU$,1)<"1" OR RIGHT$(TU$,1)>"4" THEN TU$="":GOTO430
442 H=VAL(TU$):GOSUB8000:TU=H:C(TU)=VAL(MID$(D$,TU,1))
443 F2$=LEFT$(FR$,1)
444 FR$=MID$(D$,FR,1):TU$=MID$(D$,TU,1)
445 IF FR$="6" OR FR$="3" OR FR$="7" THEN ER=1:GOTO900
446 IF TU$="1" OR TU$="8" OR TU$="2" OR TU$="9" THEN ER=2:GOTO900
447 IF TU$="4" OR TU$="5" THEN ER=2:GOTO900
451 IF FR$="1" AND TU$="6" THEN C(TU)=6:C(FR)=1:GOTO468
452 IF FR$="2" AND TU$="6" THEN C(TU)=7:C(FR)=8:GOTO468
453 IF FR$="2" AND TU$="7" THEN C(TU)=7:C(FR)=2:GOTO468
454 IF FR$="4" AND TU$="6" THEN C(TU)=3:C(FR)=8:GOTO468
455 IF FR$="5" AND TU$="7" THEN C(TU)=3:C(FR)=9:GOTO468
456 IF FR$="8" AND TU$="3" THEN C(TU)=6:C(FR)=4:GOTO468
457 IF FR$="9" AND TU$="3" THEN C(TU)=7:C(FR)=5:GOTO468
458 IF FR$="5" AND TU$="6" THEN C(TU)=3:C(FR)=1:GOTO468
464 IF FR$="1" THEN C(TU)=6:C(FR)=5:GOTO468
465 IF FR$="4" THEN C(TU)=3:C(FR)=4:GOTO468
466 IF FR$="2" THEN C(TU)=7:C(FR)=4:GOTO468
468 C=C(TU):C(TU)=C(FR):C(FR)=C
470 D$="":FOR X=1 TO 12:D$=D$+RIGHT$(STR$(C(X)),1):NEXT X
480 PRINTLEFT$(DO$,23);TAB(20);" ";TAB(31);" ";
490 FOR X=1 TO 12:B(X)=VAL(MID$(D$,X,1)):NEXT X
500 MV=MV+1:MO$=RV$+WH$+STR$(MV)+RO$:PRINTLEFT$(DO$,21);TAB(25);MO$;:GOTO302
600 FOR X=1 TO 5
610 PRINTLEFT$(DO$,25);TAB(8);WIN$;:FOR TM=1 TO 500:NEXT TM
620 PRINTLEFT$(DO$,25);TAB(8);ER$(0);:FOR TM=1 TO 500:NEXT TM:NEXT X
630 GOTO8310
899 REM- FLASH ERROR MESSAGES
900 F2$="":FOR X=1 TO 5
910 PRINT LEFT$(DO$,25);TAB(22-LEN(ER$(ER))/2);ER$(ER);:FOR TM=1 TO 500:NEXT TM
920 PRINT LEFT$(DO$,25);TAB(9);ER$(0);:FOR TM=1 TO 500:NEXT TM:NEXT X:GOTO302
1000 REM- INSTRUCTIONS
1005 POKE 53281,1
1010 PRINT CL$;LEFT$(DO$,3);TAB(14);H2$:PRINT:PRINT
1020 PRINT" [217]OUR MISSION (SHOULD YOU DECIDE TO":PRINT
1030 PRINT" ACCEPT IT): [211]OLVE THIS PUZZLE IN THE":PRINT
1035 PRINT" LEAST NUMBER OF MOVES.":PRINT
1040 PRINT" [208]EGS ARE ARRANGED ON THE PLAYING":PRINT
1050 PRINT" SCREEN AS FOLLOWS:"
1060 ZZ=1:FOR TM=1 TO 2000:NEXT TM:PRINT CL$;UC$;:GOSUB1500:POKE53281,1
1070 PRINT CL$;LEFT$(DO$,3);TAB(14);H2$:PRINT:PRINT:ZZ=0
1080 PRINT" [210]EVERSE THE PEGS TO THE OPPOSITE":PRINT
1090 PRINT" POSITIONS IN THE '[197]'.":PRINT:PRINT
1100 PRINT" [205]OVE EACH PEG TO AN EMPTY SPACE OR":PRINT
1110 PRINT" OVER ANOTHER PEG TO AN EMPTY SPACE.":PRINT:PRINT
1120 PRINT" [199]OOD [204]UCK AND [200]APPY [208]UZZLING !"
1130 FOR TM=1 TO 3000:NEXT TM
1500 GOSUB11000:FOR X=1 TO LEN(D$):B(X)=VAL(MID$(D$,X,1)):C(X)=B(X):NEXT:F2$=""
1510 MV=0:POKE53281,11:PRINT CL$;UC$;:GOTO302
8000 REM- CONVERT 'FROM-TO' TO POSITION IN STRING
8010 IF H=11 THEN H=1:RETURN
8020 IF H=12 THEN H=2:RETURN
8030 IF H=13 THEN H=3:RETURN
8040 IF H=14 THEN H=4:RETURN
8050 IF H=22 THEN H=5:RETURN
8060 IF H=32 THEN H=6:RETURN
8070 IF H=33 THEN H=7:RETURN
8080 IF H=42 THEN H=8:RETURN
8090 IF H=51 THEN H=9:RETURN
8100 IF H=52 THEN H=10:RETURN
8110 IF H=53 THEN H=11:RETURN
8120 IF H=54 THEN H=12:RETURN
8200 REM- MOVE INVALID
8210 FOR X=1 TO 5
8220 PRINTLEFT$(DO$,25);TAB(9);ER$(3);:FOR TM=1 TO 500:NEXT TM
8230 PRINTLEFT$(DO$,25);TAB(9);ER$(0);:FOR TM=1 TO 500:NEXT TM
8240 NEXT X:F2$="":GOTO302
8300 REM- END PUZZLE MESSAGE
8310 PRINTLEFT$(DO$,25);TAB(7);EN$;:FOR TM=1 TO 1500:NEXT TM:PRINT CL$:END
10000 REM- BUILD CHARACTER GRAPHICS
10100 WH$=CHR$(5):BLK$=CHR$(144):RED$=CHR$(28):GRN$=CHR$(30):YEL$=CHR$(158)
10105 CYN$=CHR$(159):B2LU$=CHR$(31)
10110 DW$=CHR$(17):UP$=CHR$(145)+CHR$(145)
10120 FOR X=1 TO 24:DO$=DO$+DW$:NEXT X:DO$=CHR$(19)+DO$
10130 LF$=CHR$(157)+CHR$(157)+CHR$(157)
10140 LC$=CHR$(14):UC$=CHR$(142)
10145 RV$=CHR$(18):RO$=CHR$(146)
10150 PEG$=CHR$(113):CL$=CHR$(147)
10160 A$(1)=RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$+WH$+PE$
10165 A$(1)=A$(1)+RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$
10170 A$(2)=RV$+GRN$+" "+RO$+DW$+LF$+RV$+GRN$+" "+RO$+BLK$+PE$
10175 A$(2)=A$(2)+RV$+GRN$+" "+RO$+DW$+LF$+RV$+GRN$+" "+RO$
10180 A$(3)=RV$+YEL$+" "+RO$+DW$+LF$+RV$+YEL$+" "+RO$
10185 A$(3)=A$(3)+DW$+LF$+RV$+YEL$+" "+RO$
10190 A$(4)=RV$+YEL$+" "+RO$+DW$+LF$+RV$+YEL$+" "+RO$+BLK$+PE$
10195 A$(4)=A$(4)+RV$+YEL$+" "+RO$+DW$+LF$+RV$+YEL$+" "+RO$
10200 A$(5)=RV$+YEL$+" "+RO$+DW$+LF$+RV$+YEL$+" "+RO$+WH$+PE$
10205 A$(5)=A$(5)+RV$+YEL$+" "+RO$+DW$+LF$+RV$+YEL$+" "+RO$
10210 A$(6)=RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$
10215 A$(6)=A$(6)+DW$+LF$+RV$+RED$+" "+RO$
10220 A$(7)=RV$+GRN$+" "+RO$+DW$+LF$+RV$+GRN$+" "+RO$
10225 A$(7)=A$(7)+DW$+LF$+RV$+GRN$+" "+RO$
10230 A$(8)=RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$+BLK$+PE$
10235 A$(8)=A$(8)+RV$+RED$+" "+RO$+DW$+LF$+RV$+RED$+" "+RO$
10240 A$(9)=RV$+GRN$+" "+RO$+DW$+LF$+RV$+GRN$+" "+RO$+WH$+PE$
10245 A$(9)=A$(9)+RV$+GRN$+" "+RO$+DW$+LF$+RV$+GRN$+" "+RO$
10400 CR$=RV$+YEL$+" "+RO$
10410 HDG$=RV$+WH$+"THE 'E' PUZZLE"+RO$
10420 H2$=LC$+RV$+B2$+"[212]HE '[197]' [208]UZZLE"+RO$
10430 F3$=RV$+CYN$+"FROM ?"+RO$:T3$=RV$+CYN$+"TO ?"+RO$
10440 MV$=RV$+YEL$+"MOVE #"+RO$
10445 REM- ERROR MESSAGES
10450 ER$(0)=" "
10460 ER$(1)=RV$+YEL$+"'FROM' POSITION EMPTY"+RO$
10470 ER$(2)=RV$+YEL$+"'TO' POSITION OCCUPIED"+RO$
10480 ER$(3)=RV$+YEL$+"INVALID 'FROM-TO' POSITION"+RO$
10490 REM- END PUZZLE MESSAGE
10495 EN$=RV$+WH$+"THANKS FOR PLAYING. 'BYE."+RO$
10500 REM- PUZZLE SOLVED !
10505 WIN$=RV$+WH$+"YOU SOLVED THE PUZZLE !"+RO$
10510 REM- SOUND PARAMETERS
10515 VO=54296:WV=54276:AT=54277:HI=54273:LO=54272:F2$=""
10600 RETURN
10999 REM- PUZZLE FORMAT
11000 D$="111133332222"
11009 REM- PUZZLE SOLVED FORMAT
11010 D1$="888833339999":RETURN